﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Enter.DataCommon
{
	public abstract class MapSet
	{
		#region Get/Set

		/// <summary>
		/// 获取或设置成员字段的值
		/// </summary>
		/// <param name="field">成员字段</param>
		/// <returns>当field不存在时返回空。</returns>
		public abstract object this[string field]
		{
			get;
			protected internal set;
		}

		/// <summary>
		/// 获取或设置成员字段的值
		/// </summary>
		/// <param name="index">成员字段的编号[DataSchema.IndexOf]方法确定</param>
		/// <returns>当index不存在时返回空。</returns>
		public abstract object this[int index]
		{
			get;
			protected internal set;
		}

		/// <summary>
		/// 获取字段值
		/// </summary>
		/// <typeparam name="T">成员数据类型</typeparam>
		/// <param name="field">成员名称</param>
		/// <returns>字段值</returns>
		protected internal abstract T Get<T>(string field);

		/// <summary>
		/// 设置字段值
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="field">成员名称</param>
		/// <param name="value">字段值</param>
		/// <remarks>返回true表示修改成功</remarks>
		protected internal abstract bool Set<T>(string field, T value);

		#endregion

	}
}
